
package com.example.swordjava;


import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;

public class Test79 {

    public static void main(String[] args) {

        int[][] aa = {{1, 2, 3, 4},
                {5, 6, 7, 8},
                {9, 10, 11, 12},
                {13, 14, 15, 16}};

        int a = 1;
        int b = 4;
        int c = 4 * (b - a) / 2;

        System.out.println(Math.pow(1, 10));
        System.out.println(c);

    }

    public class TreeNode {
        int val = 0;
        TreeNode left = null;
        TreeNode right = null;

        public TreeNode(int val) {
            this.val = val;

        }
    }

    /**
     * JZ79 判断是不是平衡二叉树
     * 输入一棵节点数为 n 二叉树，判断该二叉树是否是平衡二叉树。
     * 在这里，我们只需要考虑其平衡性，不需要考虑其是不是排序二叉树
     */

    public boolean IsBalanced_Solution(TreeNode pRoot) {
        // write code here

        if (pRoot == null) return true;

        return Math.abs(getDepth(pRoot.left) - getDepth(pRoot.right)) <= 1 && IsBalanced_Solution(pRoot.left) && IsBalanced_Solution(pRoot.right);

    }

    public int getDepth(TreeNode pRoot) {
        if (pRoot == null) return 0;
        return Math.max(getDepth(pRoot.left), getDepth(pRoot.right)) + 1;
    }

}














